package com.easybeanfit.UUService.commutill;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Created by Andy on 2016/6/9.
 */

public class UUNetUtill {
    /**
     * 检查是否有网络连接
     * @param paramContext
     * @return
     */
    public static boolean isConnected(Context paramContext) {
        ConnectivityManager localConnectivityManager = (ConnectivityManager) paramContext
                .getSystemService("connectivity");
        if (localConnectivityManager != null) {
            NetworkInfo localNetworkInfo = localConnectivityManager
                    .getActiveNetworkInfo();
            if ((localNetworkInfo != null)
                    && (localNetworkInfo.isConnected())
                    && (localNetworkInfo.getState() == NetworkInfo.State.CONNECTED))
                return true;
        }
        return false;
    }
}
